$(document).ready(function() {
    $('.errorForm').submit(function() {
        var returnVal = true;
        var email = $(this).children('.errorEmail').val();
        var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        var editor = tinyMCE.getInstanceById('errorText');
        if(!email || !reg.test(email)) {
            console.log(email);
            $(this).children('.errorEmail').css({'border-color':'red', 'background-color':'#FFE0E1'});
            returnVal = false;
        } else $(this).children('.errorEmail').css({'border-color':'black', 'background-color':'#FFFFFF'});
        if(!editor.getContent()) {
            editor.getBody().style.backgroundColor = "#FBC2C4";
            returnVal = false;
        } else editor.getBody().style.backgroundColor = "#FFFFFF";
        if($(this).children('.errorLogin').val() == '') {
            $(this).children('.errorLogin').css({'border-color':'red', 'background-color':'#FFE0E1'});
            returnVal = false;
        } else $(this).children('.errorLogin').css({'border-color':'black', 'background-color':'#FFFFFF'});
        return returnVal;
    });
});    